package com.bsh.repository;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Repository;

import com.bsh.mybatis.IRepository.WxRecomendMapper;
import com.bsh.mybatis.model.WxRecomend;

@Repository
public class DaoWxRec {
	@Resource
	SqlSessionTemplate session;
	@Resource
	JdbcTemplate jdbcTemplate;
	@Resource
	NamedParameterJdbcTemplate namedJdbcTemplate;
	
	
	WxRecomendMapper getMapper() {
		return session.getMapper(WxRecomendMapper.class);
	}

	public int deleteByPrimaryKey(Integer id) {
		int res = getMapper().deleteByPrimaryKey(id);
		return res;
	}

	public int insert(WxRecomend record) {
		int res = getMapper().insert(record);
		return record.getId();
	}

	public int insertSelective(WxRecomend record) {
		int res = getMapper().insertSelective(record);
		return record.getId();
	}

	public WxRecomend selectByPrimaryKey(Integer id) {
		WxRecomend row = getMapper().selectByPrimaryKey(id);
		return row;
	}

	public int updateByPrimaryKeySelective(WxRecomend record) {
		int res = getMapper().updateByPrimaryKeySelective(record);
		return res;
	}

	public int updateByPrimaryKey(WxRecomend record) {
		int res = getMapper().updateByPrimaryKey(record);
		return res;
	}

	public WxRecomend selectByUnionId(WxRecomend record) {
		WxRecomend row = getMapper().selectByUnionId(record);
		return row;
	}
	/**
	 * 用户注册时 检查是否微信锁粉
	 * @param record
	 * @return
	 */
	public WxRecomend selectByUnionIdRegister(WxRecomend record) {
		WxRecomend row = getMapper().selectByUnionIdRegister(record);
		return row;
	}
}
